[Connectors] Implement health check for connectors - #3811
Conversation
| auth_resp = requests.post( | ||
| url=auth_url, | ||
| headers=auth_headers, | ||
| verify=verify_ssl, | ||
| timeout=10, | ||
| ) | ||
| auth_resp.raise_for_status() | ||
| access_token = auth_resp.json().get("access_token") | ||
|
|
There was a problem hiding this comment.
For yeti:
I am checking a post request to get the access token, if the server responsds a valid token then the health check passes.
Check this
There was a problem hiding this comment.
same here ,a comment in the code about your decision of using the access token and why, just like you did in this github comment
| try: | ||
| client = slack_sdk.WebClient(token=token) | ||
| client.auth_test() | ||
| return True |
There was a problem hiding this comment.
Slack:
- this tests if the token is valid by doing an authentication test + returns identity info (discarded that info)
we had two more params (channel and slack_username) channel just wants a valid channel name on the slack channel and slack_username could be anything (this is just added to the info we send to slack). So I have not added these two to the test + auth_test() requires only the token
Official docs here
| try: | ||
| client = pycti.OpenCTIApiClient(url, token, ssl_verify=ssl_verify, proxies=proxies) | ||
| resp = client.health_check() | ||
| return resp |
There was a problem hiding this comment.
There was a problem hiding this comment.
thanks for showing the demo. Very helpful. Is there any chance to modify the toast shown to the user to explain which is the issue? Otherwise it would be difficult for an user to understand the cause. Admins have logs but a classic user can't see them.
That would be a very good addition for all the cases
There was a problem hiding this comment.
also here, please add a comment and a link about what you explained regarding the health check
There was a problem hiding this comment.
thanks for showing the demo. Very helpful. Is there any chance to modify the toast shown to the user to explain which is the issue? Otherwise it would be difficult for an user to understand the cause. Admins have logs but a classic user can't see them. That would be a very good addition for all the cases
yaa I was also thinking about this while doing it that it would better if the cause was visible in the ui itself, I will check and let you know
| try: | ||
| misp = pymisp.PyMISP( | ||
| url=url, | ||
| key=key, | ||
| ssl=ssl_param, | ||
| debug=False, | ||
| timeout=5, | ||
| ) | ||
|
|
||
| misp.misp_instance_version | ||
| return True | ||
|
|
||
| except Exception as e: | ||
| logger.info(f"MISP health check failed: {e}") | ||
| return False |
There was a problem hiding this comment.
MISP:
- misp_instance_version returns the server's (MISP instance) version, so it does make a request to the server and also checks the validity of the api key
There was a problem hiding this comment.
There was a problem hiding this comment.
can you add the information about misp_instance_version as a comment? Otherwise that info would be lost for future maintainers.
|
Hi @mlodic please have a look at this. Email sender/abuse submitter do not use config url/api key or remote instances so I have not done anything for them. If changes are required then do let me know. Thanks! |
mlodic
left a comment
There was a problem hiding this comment.
good work, added some comments
| try: | ||
| client = pycti.OpenCTIApiClient(url, token, ssl_verify=ssl_verify, proxies=proxies) | ||
| resp = client.health_check() | ||
| return resp |
There was a problem hiding this comment.
thanks for showing the demo. Very helpful. Is there any chance to modify the toast shown to the user to explain which is the issue? Otherwise it would be difficult for an user to understand the cause. Admins have logs but a classic user can't see them.
That would be a very good addition for all the cases
| try: | ||
| misp = pymisp.PyMISP( | ||
| url=url, | ||
| key=key, | ||
| ssl=ssl_param, | ||
| debug=False, | ||
| timeout=5, | ||
| ) | ||
|
|
||
| misp.misp_instance_version | ||
| return True | ||
|
|
||
| except Exception as e: | ||
| logger.info(f"MISP health check failed: {e}") | ||
| return False |
There was a problem hiding this comment.
can you add the information about misp_instance_version as a comment? Otherwise that info would be lost for future maintainers.
| try: | ||
| client = pycti.OpenCTIApiClient(url, token, ssl_verify=ssl_verify, proxies=proxies) | ||
| resp = client.health_check() | ||
| return resp |
There was a problem hiding this comment.
also here, please add a comment and a link about what you explained regarding the health check
| try: | ||
| client = slack_sdk.WebClient(token=token) | ||
| client.auth_test() | ||
| return True |
| auth_resp = requests.post( | ||
| url=auth_url, | ||
| headers=auth_headers, | ||
| verify=verify_ssl, | ||
| timeout=10, | ||
| ) | ||
| auth_resp.raise_for_status() | ||
| access_token = auth_resp.json().get("access_token") | ||
|
|
There was a problem hiding this comment.
same here ,a comment in the code about your decision of using the access token and why, just like you did in this github comment
|
I will add the comments as you said and then this PR can be closed. For the failure messages, we have to do slight changes in the backend, health_check methods and the frontend files. Thanks for the review 🙌 |
|
thanks to you for the work, looking forward the next improvements. |
… and YETI connectors
|
Hey @mlodic, I have added the comments. |
|
yep if possible yes so we can track possible changes in the future |
…P, OpenCTI, Slack, and YETI connectors
|
@mlodic Done 🔥 |











Closes #928
Description
Health Check methods implemented for connectors
Type of change
Checklist
gsoc-2026/connectorstestsfolder). All the tests (new and old ones) gave 0 errors.